package pe.edu.sistemas.samupg.domain.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Comentario generated by hbm2java
 */
@Entity
@Table(name = "comentario", schema = "bd_samupg")
public class Comentario implements java.io.Serializable {

	private static final long serialVersionUID = 6873638828355634509L;
	
	private Long idComentario;
	private Noticia noticia;
	private Date fecha;
	private String contenido;
	private String email;

	public Comentario() {
	}

	public Comentario(Noticia noticia, Date fecha,
			String contenido, String email) {
		this.noticia = noticia;
		this.fecha = fecha;
		this.contenido = contenido;
		this.email = email;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "comentario_id", unique = true, nullable = false, precision = 12, scale = 0)
	public Long getIdComentario() {
		return this.idComentario;
	}

	public void setIdComentario(Long comentarioId) {
		this.idComentario = comentarioId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "comentario_noticia_id", nullable = false)
	public Noticia getNoticia() {
		return this.noticia;
	}

	public void setNoticia(Noticia noticia) {
		this.noticia = noticia;
	}

	@Column(name = "comentario_fecha", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	public Date getFecha() {
		return this.fecha;
	}

	public void setFecha(Date fecha) {
		this.fecha = fecha;
	}

	@Column(name = "comentario_contenido", nullable = false, length = 65535)
	public String getContenido() {
		return this.contenido;
	}

	public void setContenido(String comentarioContenido) {
		this.contenido = comentarioContenido;
	}

	@Column(name = "comentario_email", nullable = false)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String comentarioEmail) {
		this.email = comentarioEmail;
	}
}
